<?php

echo "this is the db management library test page<br>";
echo "Launch test...<br>\n";

include('../sources/php/dbLib.php');
echo "Found dbLib.php";

echo '<br>';

echo "Create a new database object and connect...<br>";
//Set $debug to true to get debug messages
$debug = true;

$db = new Database();  
if($db->connect($debug))
{
	echo "succeed to connect to database<br> ";
}
else
{
	echo "Failed to connect to database<br> ";
}

echo "try another connection, should detect it's already connected<br>"; 
$db->connect($debug);

echo "Disconnect and reconnect<br>";
if($db->disconnect())
{
	echo "Disconnection successful !<br>";
}
else
{
	echo "Disconnection failed";
}
if($db->connect())
{
	echo "Disconnection successful !<br>";
}
else
{
	echo "connection failed";
}

echo "Try to select a non existent table :<br>";
$db->select($debug,'nimportquoi');

echo "And then, a good one :<br>";
if($db->select($debug,'simpletable'))
{
	echo "Found table<br>";
}
?>

